import echarts from "@/plugins/echarts.plugin";

/** echart图表的通用配置 */
export const pieCommonOptions = {
  color: ["#0075FF", "#15CE89", "#FFBB00", "#FF844D"],
  tooltip: {},
  legend: {
    bottom: 20,
    left: "center",
    itemWidth: 8,
    itemHeight: 8,
    borderRadius: 10,
    icon: "circle",
  },
  series: [
    {
      name: "",
      type: "pie",
      center: ["50%", "40%"],
      radius: ["55%", "70%"],
      avoidLabelOverlap: false,
      itemStyle: {
        borderRadius: 4,
        borderColor: "#fff",
        borderWidth: 2,
      },
      labelLine: {
        show: false,
      },
      data: [],
    },
  ],
};
export const lineCommonOptions = {
  xAxis: {
    type: "category",
    data: [],
    axisTick: {
      alignWithLabel: true,
    },
  },
  grid: {
    left: 60,
    right: 30,
    bottom: 50,
    top: 20,
  },
  tooltip: {
    trigger: "axis",
  },
  yAxis: {
    type: "value",
  },
  series: [
    {
      showSymbol: false,
      symbolSize: 14,
      data: [],
      type: "line",
      emphasis: {
        itemStyle: {
          color: "#0075FF",
          borderWidth: 4,
          borderColor: "#fff",
          shadowColor: "rgba(0, 0, 0, 0.2)",
          shadowBlur: 10,
        },
      },
      smooth: true,
      lineStyle: {
        borderWidth: 6,
      },
      itemStyle: {
        color: "#0075FF",
      },
      areaStyle: {
        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
          {
            offset: 0,
            color: "rgba(22, 119, 255,0.3)",
          },
          {
            offset: 1,
            color: "rgba(22, 119, 255,0)",
          },
        ]),
      },
    },
  ],
};
